<html>
<head>
    <title>BECKN - DEV</title>
</head>
<body>
</body>
<script type="text/javascript">
    window.__OS = "ANDROID";
    window.JBridge = top.JBridge;
    window.Android = top.Android;
    window.DUIGatekeeper = JBridge;
    window.JBridge.setAnalyticsHeader(JSON.stringify({"x-client-id": "mobility"}));
</script>

<script type="text/javascript">
    var ip = DUIGatekeeper.getResourceByName("local_ip");
    var port = DUIGatekeeper.getResourceByName("dev_port");
    port = port ? port : "8080";
    var url = "http://" + ip + ":" + port;
    var headID = document.getElementsByTagName("head")[0];
    var newScript = document.createElement('script');
    newScript.type = 'text/javascript';
    newScript.id = 'socket';
    newScript.src = url + '/dist/index_bundle.js';
    headID.appendChild(newScript);

</script>
<!--
<script type="text/javascript">
    var ip = DUIGatekeeper.getResourceByName("local_ip");
    var port = DUIGatekeeper.getResourceByName("dev_port");
    port = port ? port : "8080";
    var url = "http://" + ip + ":" + port;
	var reloadApp = function() {
		console.log("Reloading app")
		var headID = document.getElementsByTagName("head")[0];
        var newScript = document.createElement('script');
        newScript.type = 'text/javascript';
        newScript.id = 'mystique';
        newScript.src = url + '/dist/index_bundle.js';
        headID.appendChild(newScript);
        console.log("URL 2 ===>", url + '/dist/index_bundle.js');
	}
	var currentHash = null
	var onSocketMsg = {
		"hot": function() {
			console.log("hot");
		},
		"invalid": function() {
			console.log("App updated. Recompiling...");
		},
		"hash": function(hash) {
			currentHash = hash;
			console.log(hash);
		},
		"still-ok": function() {
			console.log("App ready.");
		},
		"ok": function() {
			console.log("It is ok");
			reloadApp();
		},
		"warnings": function(warnings) {
			console.log("Warnings while compiling.");
			reloadApp();
		},
		"errors": function(errors) {
			console.log("App updated with errors. No reload!");

			if (Android)
			    Android.throwError(errors[0]);
		},
		"proxy-error": function(errors) {
			console.log("Could not proxy to content base target!");

			if (Android)
			    Android.throwError(errors[0]);
		},
		"close": function() {
			console.log("Disconnected.");
		},
		"log-level": function(){
		}
	}
	window.onload = function() {
	    var sock = new SockJS(url + '/sockjs-node');
		sock.onopen = function() {
		   console.log('open');
		};
		sock.onmessage = function(e) {
		  var msg = JSON.parse(e.data);
		  if(typeof onSocketMsg[msg.type] == "function")
		    onSocketMsg[msg.type](msg.data)
		};
		sock.onclose = function() {
		   console.log('close');
		};
	}
</script> -->
</html>